package leetcode.day_2020_11_16_11_22;

public class L_26 {
    public static void main(String[] args) {
        int[] nums = {0,0,1,1,1,2,2,3,3,4};
        System.out.println(removeDuplicates(nums));
    }

    public static int removeDuplicates(int[] nums) {
        int count = 1;
        int slow = 0;
        for(int i=1; i<nums.length; i++) {
            if(nums[i] != nums[slow]){
                nums[slow+1] = nums[i];
                slow = slow + 1;
                count = count + 1;
            }
        }
        return count;
    }
}
